home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 August / ENTER.ISO / files / gimp-2.0.5-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / textured-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2004-09-26  |  6.5 KB  |  169 lines

  1. ;  BLENDED-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a blended background using current gimp fg
  3. ;   and bg colors.  The finished blend has a drop shadow underneath that blends
  4. ;   to the specified bg-color
  5. ;  if the blend colors are specified as high intensity, the sharp option
  6. ;   should be enabled or the logo will come out blurry
  7.  
  8. (define (scale size percent) (* size percent))
  9.  
  10. (define (apply-textured-logo-effect img
  11.                     logo-layer
  12.                     b-size
  13.                     text-pattern
  14.                     tile-type
  15.                     bg-color
  16.                     blend-fg
  17.                     blend-bg)
  18.   (let* ((b-size-2 (scale b-size 0.5))
  19.      (f-size (scale b-size 0.75))
  20.      (ds-size (scale b-size 0.5))
  21.      (ts-size (- b-size-2 3))
  22.      (width (car (gimp-drawable-width logo-layer)))
  23.      (height (car (gimp-drawable-height logo-layer)))
  24.      (blend-layer (car (gimp-layer-new img width height RGBA-IMAGE
  25.                        "Blend" 100 NORMAL-MODE)))
  26.      (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  27.                         "Shadow" 100 NORMAL-MODE)))
  28.      (text-shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  29.                          "Text Shadow" 100 MULTIPLY-MODE)))
  30.      (tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer
  31.                               ADD-BLACK-MASK)))
  32.      (drop-shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  33.                          "Drop Shadow" 100 MULTIPLY-MODE)))
  34.      (dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer
  35.                               ADD-BLACK-MASK)))
  36.      (old-fg (car (gimp-palette-get-foreground)))
  37.      (old-bg (car (gimp-palette-get-background)))
  38.      (old-pattern (car (gimp-patterns-get-pattern))))
  39.  
  40.     (script-fu-util-image-resize-from-layer img logo-layer)
  41.     (gimp-image-add-layer img shadow-layer 1)
  42.     (gimp-image-add-layer img blend-layer 1)
  43.     (gimp-image-add-layer img drop-shadow-layer 1)
  44.     (gimp-image-add-layer img text-shadow-layer 0)
  45.     (gimp-selection-all img)
  46.     (gimp-patterns-set-pattern text-pattern)
  47.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  48.     (gimp-edit-bucket-fill logo-layer PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  49.     (gimp-selection-none img)
  50.     (gimp-edit-clear text-shadow-layer)
  51.     (gimp-edit-clear drop-shadow-layer)
  52.     (gimp-palette-set-background bg-color)
  53.     (gimp-drawable-fill shadow-layer BACKGROUND-FILL)
  54.     (gimp-rect-select img b-size-2 b-size-2 (- width b-size) (- height b-size)
  55.               CHANNEL-OP-REPLACE TRUE b-size-2)
  56.     (gimp-palette-set-background '(0 0 0))
  57.     (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  58.     (gimp-selection-layer-alpha logo-layer)
  59.     (gimp-layer-add-mask text-shadow-layer tsl-layer-mask)
  60.     (gimp-palette-set-background '(255 255 255))
  61.     (gimp-edit-fill tsl-layer-mask BACKGROUND-FILL)
  62.     (gimp-selection-feather img f-size)
  63.     (gimp-palette-set-background '(63 63 63))
  64.     (gimp-edit-fill drop-shadow-layer BACKGROUND-FILL)
  65.     (gimp-palette-set-background '(0 0 0))
  66.     (gimp-edit-fill text-shadow-layer BACKGROUND-FILL)
  67.     (gimp-palette-set-foreground '(255 255 255))
  68.  
  69.     (gimp-edit-blend text-shadow-layer FG-BG-RGB-MODE NORMAL-MODE
  70.              GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
  71.              FALSE 0 0 TRUE
  72.              0 0 1 1)
  73.  
  74.     (gimp-selection-none img)
  75.     (gimp-palette-set-foreground blend-fg)
  76.     (gimp-palette-set-background blend-bg)
  77.  
  78.     (gimp-edit-blend blend-layer FG-BG-RGB-MODE NORMAL-MODE
  79.              GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
  80.              FALSE 0 0 TRUE
  81.              0 0 width 0)
  82.  
  83.     (plug-in-mosaic 1 img blend-layer 12 1 1 0.7 TRUE 135 0.2 TRUE FALSE
  84.             tile-type 1 0)
  85.  
  86.     (gimp-layer-translate logo-layer (- b-size-2) (- b-size-2))
  87.     (gimp-layer-translate blend-layer (- b-size) (- b-size))
  88.     (gimp-layer-translate text-shadow-layer (- ts-size) (- ts-size))
  89.     (gimp-layer-translate drop-shadow-layer ds-size ds-size)
  90.     (gimp-selection-layer-alpha blend-layer)
  91.     (gimp-layer-add-mask drop-shadow-layer dsl-layer-mask)
  92.     (gimp-palette-set-background '(255 255 255))
  93.     (gimp-edit-fill dsl-layer-mask BACKGROUND-FILL)
  94.     (gimp-layer-remove-mask drop-shadow-layer MASK-APPLY)
  95.     (gimp-selection-none img)
  96.     (gimp-patterns-set-pattern old-pattern)
  97.     (gimp-palette-set-foreground old-fg)
  98.     (gimp-palette-set-background old-bg)))
  99.  
  100. (define (script-fu-textured-logo-alpha img
  101.                        logo-layer
  102.                        b-size
  103.                        text-pattern
  104.                        tile-type
  105.                        bg-color
  106.                        blend-fg
  107.                        blend-bg)
  108.   (begin
  109.     (gimp-image-undo-group-start img)
  110.     (apply-textured-logo-effect img logo-layer b-size text-pattern tile-type
  111.                 bg-color blend-fg blend-bg)
  112.     (gimp-image-undo-group-end img)
  113.     (gimp-displays-flush)))
  114.  
  115. (script-fu-register "script-fu-textured-logo-alpha"
  116.             _"<Image>/Script-Fu/Alpha to Logo/_Textured..."
  117.             "Creates textured logos with blended backgrounds, highlights, and shadows"
  118.             "Spencer Kimball"
  119.             "Spencer Kimball"
  120.             "1996"
  121.             "RGBA"
  122.                     SF-IMAGE      "Image"                 0
  123.                     SF-DRAWABLE   "Drawable"              0
  124.             SF-ADJUSTMENT _"Border Size (pixels)" '(20 1 100 1 10 0 1)
  125.             SF-PATTERN    _"Pattern"              "Fibers"
  126.             SF-OPTION     _"Mosaic Tile Type"     '(_"Squares"
  127.                                  _"Hexagons"
  128.                                  _"Octagons")
  129.             SF-COLOR      _"Background Color"     '(255 255 255)
  130.             SF-COLOR      _"Starting Blend"       '(32 106 0)
  131.             SF-COLOR      _"Ending Blend"         '(0 0 106))
  132.  
  133. (define (script-fu-textured-logo text
  134.                  size
  135.                  fontname
  136.                  text-pattern
  137.                  tile-type
  138.                  bg-color
  139.                  blend-fg
  140.                  blend-bg)
  141.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  142.      (b-size (scale size 0.1))
  143.      (text-layer (car (gimp-text-fontname img -1 0 0 text b-size
  144.                           TRUE size PIXELS fontname))))
  145.     (gimp-image-undo-disable img)
  146.     (gimp-drawable-set-name text-layer text)
  147.     (apply-textured-logo-effect img text-layer b-size text-pattern tile-type
  148.                 bg-color blend-fg blend-bg)
  149.     (gimp-image-undo-enable img)
  150.     (gimp-display-new img)))
  151.  
  152. (script-fu-register "script-fu-textured-logo"
  153.             _"<Toolbox>/Xtns/Script-Fu/Logos/_Textured..."
  154.             "Creates textured logos with blended backgrounds, highlights, and shadows"
  155.             "Spencer Kimball"
  156.             "Spencer Kimball"
  157.             "1996"
  158.             ""
  159.             SF-STRING     _"Text"               "The GIMP"
  160.             SF-ADJUSTMENT _"Font Size (pixels)" '(200 1 1000 1 10 0 1)
  161.             SF-FONT       _"Font"               "CuneiFont"
  162.             SF-PATTERN    _"Text Pattern"       "Fibers"
  163.             SF-OPTION     _"Mosaic Tile Type"   '(_"Squares"
  164.                                _"Hexagons"
  165.                                _"Octagons")
  166.             SF-COLOR      _"Background Color"   '(255 255 255)
  167.             SF-COLOR      _"Starting Blend"     '(32 106 0)
  168.             SF-COLOR      _"Ending Blend"       '(0 0 106))
  169.